package com.example.poverty.service.impl;

import com.example.poverty.dao.TownsMapper;
import com.example.poverty.entity.Towns;
import com.example.poverty.service.TownsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 前端 村镇service 实现类
 */
@Service
public class TownsServiceImpl implements TownsService {

    @Autowired
    private TownsMapper townsMapper;

    @Override
    public boolean insert(Towns towns) {
        return townsMapper.insert(towns) > 0;
    }

    @Override
    public boolean update(Towns towns) {
        return townsMapper.update(towns) > 0;
    }

    @Override
    public boolean delete(Integer id) {
        return townsMapper.delete(id) > 0;
    }

    @Override
    public Towns selectByPrimaryKey(Integer id) {
        return townsMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Towns> allTowns() {
        return townsMapper.allTowns();
    }

    @Override
    public Towns getByTotalHouse(Integer totalHouse) {
        return townsMapper.getByTotalHouse(totalHouse);
    }
}
